Project Development

Hi and welcome! It's the last blog for this module and I will be documenting all the knowledge I learned from ICPD & CPDD in this blog. 

On this page, I will:

  1. Briefly describe my team's chemical device

  2. Show how the team planned, allocated the tasks, and executed the project. 

  3. Document the entire design and build process of the chemical device and include videos, pictures, and screen captures of the processes.

  4. Include a “Hero shot” of every milestone of the processes, for example, part A that was 3D printed, part B that was laser-cut, and electronics components moved/worked according to the program. A hero shot is taken with the person-in-charge holding/working/making the parts.

  5. Include the name of the person who was in charge of every part of the project. 

  6. Document my individual contribution to this project.

  7. Provide the link to the page of the blog of my teammates. 

  8. Describe problems encountered and how the team solved them.

  9. Include all the project design files as downloadable files. 

  10. Embed the final prototype design file, i.e., the final fusion360 design file showing the entire prototype.

  11. Type my Learning reflection on the overall project development.



OUR CHEMICAL DEVICE
CHEMICAL DEVICE:
Our team's chemical device is an automated watering system to water plants.

BACKGROUND:
Based on the article published in “The Straits Times”, Covid-19 has led to a botanic boom in Singapore as more people become plant parents to relieve stress while working from home. Many people think that plant parenting has been especially helpful during the circuit breaker as more people spend time at home beavering in front of their computers. Hence, planting has given them an extension of their own space into the outside world and a chance to reconnect with nature.



Plant sellers like Terrascpaes, a nursery specialising in exotic plants, saw a 10% increase in sales. They mentioned that they sold about 1000 plants in the circuit breaker period from April to June after it started retailing its plants online. 

Now, our borders have lifted and people started to travel more frequently as compared to the pre-covid period. HOW are plant owners supposed to water the plant when they are overseas? HOW can we help plant owners from overwatering their plants? HOW can we ensure that plant owners have the time to water their plants, even during their daily busy schedules?

EXISTING SOLUTION:
Plant owners can ask their friends or relatives to look after their plants while they are overseas. However, it may be troublesome to seek help from friends to look after the plants as they might be busy, or would not know the right amount of water to give. This may do more harm than good to the plant.

There are many DIY self-watering kit tutorials available for plant owners to construct; however, it can be very time-consuming to build and control the amount of water flowing into the soil. Additionally, plant owners may not have the materials required to build these DIY kits. This may lead to them spending more money than what is needed in order to purchase these materials.

OUR SOLUTION:
Our SmartPot, named Tod, will solve this issue by providing plant owners with a convenient way to keep their plants hydrated. The soil moisture sensor will sense the moisture level of the plant. If the sensor senses a low moisture level (i.e. < 15%), the sensor will send an output signal to the pump to start the pump. The pump will then be pumping the water to the soil to keep the plant hydrated. Once the sensor senses a high moisture level (above 15%), the sensor will send an output signal to stop the pump. To let the plant owners know/observe the moisture reading, we also added an LCD screen to display the soil moisture readings to the user.
This will ensure that plant owners will not have to worry about forgetting to water their plants, or dispensing the right amount of water to them.

PROBLEMS THAT OUR CHEMICAL DEVICE (SmartPot) CAN SOLVE:
Problem #1: User overwater the plant
Solution #1: Based on the current soil moisture level of the plant, SmartPot will supply water to the plant to bring the moisture level into the acceptable range. 

Problem #2: User does not have the time to water the plant
Solution #2: SmartPot’s automated watering system can last for 2 weeks. Users will only have to replenish the water tank every 2 weeks. Users will only have to worry about refilling the tank every 2 weeks.

Problem #3: Existing solutions are impractical, expensive and time-consuming to assemble the components. Hence, reducing the reliability of the device.
Solution #3: Our SmartPot is compact, inexpensive and user-friendly. Users only have to refill the water tank and plug in the power source.

THE ISSUE WE WANT TO SOLVE:
The main issue we want to solve is to find a convenient way to keep users’ plants hydrated with little effort needed.

PROBLEM STATEMENT:
How can we enhance the user’s plant parenting experience so that plant owners can save time and cost?

Here's the link to find out more about the news article: News Article

HAND SKETCH:

Interior of the electronic box:


TEAM PLANNING, ALLOCATION & EXECUTION
ROLES ALLOCATION:


FINALISED BOM:


FINALISED GANTT CHART:
Fusion team: Hannah, Justin & Keith
Coding team: Jun Hao & En Ting




DESIGN & BUILD PROCESS
PART 1: Using Fusion360 to finalise the CAD of SmartPot. (done by Hannah).
Hyperlink to Hannah's blog: Hannah

PART 2: Design and Build of the hinge, latch and latch hook. (done by Justin).
Hyperlink to Justin's blog: Justin

PART 3: Design & laser cut the laster-cut file for the pot. (done by Keith).
Hyperlink to Keith's blog: Keith

PART 4: Programming of soil moisture sensor & pump. (done by ME, En Ting).

Now, I’ll document my work for the soil moisture sensor and pump code. 

Searching for the pump code was easy and I did face major problems in terms of the code and hardware/ components. I had to involve the cost of the transistor and diode in our BOM.


Step 1, find the pump code. 

When I did the test run for the pump only, the pump was able to pump the water non-stop because I didn’t add a sensor to sense the soil moisture to the code. The part highlighted in yellow was incorrect because there’s a different code for the soil moisture sensor. The code I copied below, was a code for the pump and light sensor. I assume that all sensor works the same way as I just edited the “sensorLOW” to 15 and “sensorHIGH” to 40. The value of 15 and 40 was just random values I assume the sensor to read.


Reference: Controlling submersible pump with Arduino

const int pumpPin =  9; // the number of the pump pin

 

int sensorValue;

int sensorLow = 15; //soil moisture sensor value in %. low=on pump. fixed variable.

int sensorHigh = 40; //soil moisture sensor value in %. high=off pump. link to potentiometer.

 

void setup() {

  // initialize the pump pin as an output:

  pinMode(pumpPin, OUTPUT);

 

  while (millis() < 5000) {

    sensorValue = analogRead(A0);

   

    if (sensorValue > sensorHigh) {

    sensorHigh = sensorValue;

    }

 

    if (sensorValue < sensorLow)  {

    sensorLow = sensorValue;

    }

  }

}

 

void loop() {

 

  sensorValue = analogRead(A0);

 

  if (sensorValue < 500)  {

    digitalWrite(pumpPin, HIGH);

    delay(2000);

    digitalWrite(pumpPin, LOW);

    delay(2000);

  }

 

  if (sensorValue > 500)  {

    digitalWrite(pumpPin, LOW);

  }

 

}



Step 2, soldering

I have to solder the wires of the battery connector so that the 9v voltage can be plugged onto the breadboard. To solder the wires, make sure your soldering iron is fully heated and touch the tip to the end of one of the wires. Hold it on the wire for 3-4 seconds. Keep the iron in place and touch the solder to the wire until it's fully coated. Repeat this process on the other wire.


Video: Soldering

Click here to watch the video


Step 3, find the soil moisture sensor code.

This code is incorrect because my sensor couldn't sense any values after setting up the Arduino kit and the sensor. No inputs were generated in the serial monitor. Then, relooked at the website and realised that the sensor in the website was a 1-probe type of capacitive soil moisture sensor. Currently, we are using a 2-probe type of soil moisture sensor.  It is used to measure the volumetric content of water. The two probes allow the current to pass through the soil and then it gets the resistance value to measure the moisture value.


When there is more water, the soil will conduct more electricity which means that there will be less resistance. Therefore, the moisture level will be higher. Dry soil conducts electricity poorly, so when there will be less water, then the soil will conduct less electricity which means that there will be more resistance. Therefore, the moisture level will be lower.


The 1-probe type of sensor makes using capacitance to measure moisture an effective tactic which is slightly different from the 2-probe type. 


This is a 1-probe type sensor code which is way more complicated than the code I found in step 4. This requires me to download a library and include it in the code. The "Serial.begin(115200)" range was very big compared to "Serial.begin(9600)" in step 4.


Reference: Using a Capacitive Sensor to Measure Soil Moisture

/* Capacitive Moisture Sensor Tutorial

 * Henry Feinstein

 * March 30, 2022

 * CPLN571 Sensing the City Spring 2022

 * University of Pennsylvania

 *

 * The purpose of this code is to demonstrate the use of the Adafruit STEMMA Capacitive Moisture Sensor

 * for testing soil moisture. In addition to demonsrating how to obtain readings from the sensor,

 * the code also includes a "moving window" calculation to average readings over time, which helps

 * mitigate error and variation in sensor readings over time. This is helpful in the context of soil

 * moisture, since the rate of response for addressing soil moisture is fairly slow--this allows for

 * us to take more time to process the data before acting on it.

 *

 * The sensor also includes a low-precision temperature sensor for at-a-glance environmental information;

 * this tutorial also includes information on how to obtain that temperature reading.

 *

 * Documentation for this sensor can be found on the Adafruit website at the link below:

 * https://learn.adafruit.com/adafruit-stemma-soil-sensor-i2c-capacitive-moisture-sensor

 *

 * This code is based closely on example code written by lady ada of Adafruit, which can be found here:

 * https://learn.adafruit.com/adafruit-stemma-soil-sensor-i2c-capacitive-moisture-sensor/arduino-test

 */

 

#include "Adafruit_seesaw.h" //This library includes the functions and object definitions necessary to use the sensor

 

Adafruit_seesaw ss; //Initialize the ss ("seesaw") object, which represents the sensor

 

const int array_len = 4; //Change this value to adjust the size of the "moving window" array to calculate over-time average

                         //NOTE: this variable must be defined as constant for the array memory allocation to be successful

float reading_array[array_len]; //Initialize "moving window" array

int array_pos = 0; //Variable to use to walk through indices of array

float capread_avg = 0; //Variable to use to store average capacitance reading

int is_wet = 0; //Variable to indicate whether sensed environment is wet (1) or dry (0)

 

void setup() {

  Serial.begin(115200); //Initialize the serial monitor at a 115,200 baud rate

 

  if (!ss.begin(0x36)) { //Check to see if sensor is successfully connected to Arduino board

    Serial.println("ERROR! seesaw not found");

    while(1) delay(1);

  } else {

    Serial.print("seesaw started! version: ");

    Serial.println(ss.getVersion(), HEX);

  }

}

 

void loop() {

  float tempC = ss.getTemp(); //Using the library, obtain temperature reading from the sensor

  uint16_t capread = ss.touchRead(0); //Using the library, obtain capacative touch sensor reading from sensor

 

  if (array_pos >= array_len) { //Checking to see if we've reached the end of the array

    array_pos = 0; //If we have, go back to first position and start replacing values there

  }

  reading_array[array_pos] = capread; //Put newest capacitive reading into array

  array_pos++;

 

  capread_avg = 0; //Set up variable to calculate average

  for (int i = 0; i < array_len; i++) {

    capread_avg += reading_array[i]; //Add together all values in array

  }

  capread_avg = capread_avg / array_len; //Divide by length of array to get average

 

  if (capread_avg > 400) { //Check averaged measurement to see if environment is wet, and adjust is_wet accordingly

    is_wet = 1;

  } else {

    is_wet = 0;

  }

 

  //Print resulting readings to the serial monitor

  Serial.print("Temperature Reading: "); Serial.print(tempC); Serial.println("*C");

  Serial.print("Capacitive Reading: "); Serial.println(capread_avg);

  Serial.print("Soil Moisture Status: ");

  if (is_wet == 1) { Serial.println("Wet"); } else { Serial.println("Not Wet"); }

 

  delay(1000); //Wait before taking next reading

}



Step 4, rectify the soil moisture sensor code.

To solve the error I made previously, I narrowed down it to “soil moisture sensor 2-probe type” and found the code. Thankfully, the code works and there are values generated in the serial monitor. This raises another issue, how to convert the values (0 to 1023 range) to percentages (0 to 100% range)? 


Reference: Moisture Sensor Module

int sensorpin=A0;   //setting the sensor pin

int outputpin=13;   //setting the output pin

int moisture;  //the variable to control


void setup(){

  Serial.begin(9600);         //must begin to use serial monitor

  pinMode(sensorpin,INPUT);    //setting sensor pin to be input

  pinMode(outputpin,OUTPUT);   //setting output pin to be output

}


void loop(){

  moisture=analogRead(sensorpin);  //read the value from sensor pin

  Serial.println(moisture);  //show the value receive in serial monitor

 

 

  if(moisture<=600){                //the criticall value to trigger the solenoid

    digitalWrite(outputpin,LOW);}   //you can alternate it depends on yourself

 

  else{

    digitalWrite(outputpin,HIGH);}

 

}



Step 5, Combining the code (pump + sensor)

To save time, I just combined the codes and make relevant edits to it such as soil moisture setting and unit conversion etc. I googled and found that in order to convert the units, I’ll need to make use of the ‘serial.Print’ and ‘serial.Println’ functions. I also increased the delay time to slow down the sensor reading time and frequency of switching on/off the pump. 


I did multiple test runs and realised that setting the soil moisture condition to < 10% was the best option after watering the plant and letting the water settle inside the pot for ~2 mins. The soil moisture was about 10 to 20 %. Hence, we set it to <10%. 


There was a slight issue with the % range as well because when I fully submerse the sensor into a beaker of water, it reads 44%. When the sensor is dry, it reads -87%. However, it is not a big issue because Jun Hao managed to solve the % range issue. He adjusted the setting for the “output_value =map” range from output_value = map(output_value,550,10,0,100)” to  “output_value = map(output_value,200,1023,100,0)”

int pumpPin = 9;

int sensor_pin = A0; // Soil Sensor input at Analog PIN A0

int output_value ;



void setup()         // put your setup code here, to run once:

{

  Serial.begin(9600);                

  pinMode(pumpPin, OUTPUT);

  pinMode(sensor_pin, INPUT);

  Serial.println("Reading From the Sensor ...");

  delay(2000);

}


void loop()

{

 output_value= analogRead(sensor_pin);

  output_value = map(output_value,550,10,0,100);

 Serial.print("Mositure : ");

 Serial.print(output_value);

 Serial.println("%");

 delay(5000);

 if(output_value <10){

  digitalWrite(pumpPin, HIGH);

 }

 else

 {

  digitalWrite(pumpPin, LOW);      

 }

 delay(5000);

}



A video of the test run:



HERO SHOT:💕


However, we ended up making more adjustments to the code at the integration stage as well.


PART 5: Programming for LCD and combining all the codes. (done by Jun Hao).
Hyperlink to Jun Hao's blog: Jun Hao

PART 6: Integration of all parts and electronics, including the assembly of the final prototype. (done by everyone).

Finalised fusion 360 design files:




INTEGRATION:

Alright! Now we are ready to assemble all the components together!

Step 1, Glue all the acrylic pieces We used acrylic glue to glue the acrylic pieces together and used masking tapes to hold the pieces in place.


Video: laser cutting

Video: acrylic glueing


Step 2, Glue all the 3D-printed pieces Once the acrylic glue has dried out. We then used super glue to glue all the 3D printed components (hinges, handle & latch) onto the acrylic and the cover respectively.

 
 

Video: 3d glueing


Step 3, Create a water tank Previously, we wanted to laser cut our water tank but we are afraid that our water tank will be not leakproof. We also didn’t want to waste the 3D filament to print our water tank. Hence, we repurposed a plastic bottle into a water tank. We used scissors to cut the plastic bottle.


Next, we cut a U-shaped slot for the tubes and wire so that we can cover the tank properly.


Video: testing water pump

Video: testing water dispensing


Step 4, Combine all the codes We came together to combine all the separate codes for each component (soil moisture sensor, pump and LCD screen) together.


Here’s the final code for our prototype:

 

To download this final code, do refer to the Project Design Files section for the downloadable code file.

Step 5, Attach the Arduino kit & breadboard to our electronic box We used duct tape to secure the Arduino kit and the breadboard to the wall of the electronic box. We also used zip ties to group the wires to make our wiring system more organised and aesthetically pleasing. Furthermore, we also added small tiny tags to label the jumper wires to reduce confusion.

Step 6, Cut holes in the tube First, we had to find the section of the tube which will be inside the SmartPot. Next, we decided to cut the holes such that they will be facing the plant. At first, we cut a total of 6 holes into the tube, however, through trial and error we found out that using 2 holes was enough to supply the plant with sufficient water. As such, we taped up the rest of the holes using duct tape.

 

Step 7, Transfer the plant to our prototype We used a shove to transfer the plant into our prototype.

 

HERO SHOT with TOD:



PROBLEMS & SOLUTIONS
Problems faced by the coding team (done by En Ting & Jun Hao)

Problem

How we solved it

Problem #1: Short of components 

The pump code could not work with the existing components inside the Arduino kit. We are short of 3 components which are a 9v battery, a transistor IRF520, and a Rectifier diode IN4007. 


We needed a 9v battery as the submersible pump used, draws a larger current than the current that the Arduino output pins can supply. 


We needed an IRF520 transistor to control the pump from the low-current signals of the Arduino’s digital pins. 


We needed a diode which will be added in parallel with the pump to only allow the current to flow in one direction to protect the circuit. 

Difficulty level: Easy

We went down to Sim Lim Tower to get the IRF520 transistor. 


We got the diode from the lab and brought the 9v battery from fairprice. 

Problem #2: Used the wrong type of code

After copying and editing the soil moisture sensor code we searched online, the sensor wasn’t able to sense any values. The serial monitor was generating small tiny boxes instead of a numerical value. 


Capacitive sensor (one probe):


Soil moisture sensor (two probes):


Difficulty level: Easy

We relooked at the code and realised that the code we copied was used for a capacitive sensor which is also used to measure soil moisture but it is different from the one we got from the lab. The one that we got from the lab was called a moisture sensor module which is a simpler version than the capacitive sensor as does not require a library inside the code. 


After identifying the correct type of sensor we are using, we went to search for the code and managed to let the code work. 

Problem #3: Overheating of the module board

When we were conducting our test run, the module board (also known as the hydrometer) was overheated and started to transmit the wrong soil moisture value to the LCD screen. The sensor was supposed to sense a value of 1% but it sensed a value of 46%. 



Difficulty level: Moderate

We did a quick search and realised that we might have connected the jumper wires wrongly after we unplug the wires to assemble all the components together. 


We connected the VOC pin (module board) to the GND pin (Arduino kit) and the GND pin (module board) to the 5v pin (Arduino kit) which is wrong. This will cause the voltage regulator to overheat


Hence, we quickly unplug the USB cable, reconnect the wires and let the module board to cool for a while to bring down the temperature. 


To avoid this error, we added tags/ labels to each wire to reduce confusion and efficiency. 


Problem #4: LCD Liquidcrystal library was wrong

To use an LCD, the Arduino must have a library that provides the functionality of the LCD in the code. Arduino libraries are written using C or C++. This means that for our LCD we must have a library known as “Liquidcrystal” downloaded. Fortunately, Arduino provides this library on their website. Unfortunately for us, however, this library did not work as there was a line of code inside one of the C++ files that were written incorrectly. 


Difficulty level: Moderate

To fix the issue of the Liquidcrystal library being wrong, we had to access the C++ file and change it manually. To do this Jun Hao downloaded Microsoft Visual Studio which is an app that allows the user to code in different languages like C#, C++ and more. After downloading this app, he manually changed the incorrect line of code, however, the issue that we had during this process was that for some reason, the code would not save as the correct one. Because of this reason, the code had to be delayed until we could ask someone with more knowledge. 


The person we asked was Dr Noel, our lecturer for CPDD. He kindly helped us by downloading a new correctly made library into our computers and now with the correct library, the LCD could work

Problem #5: Potentiometer not working with LCD

Our original plan was to make the SmartPot with 2 inputs and 2 outputs. These 2 inputs would have been the soil moisture sensor and a potentiometer that users could use to select the soil moisture level of the soil ranging from 20% to 60%. However, when doing the code for this part, there were many issues with connecting the potentiometer to the LCD. The main one was that the value of the potentiometer, which was supposed to show up on the LCD,  did not update on the LCD whenever it was changed. For some reason, the LCD did not detect the change in the potentiometer

Difficulty level: Hard

To fix this issue we had done a lot of research on this topic and nothing came up. We suspect the reason for this to be that we had actually crafted this portion of the code by ourselves without any references other than the knowledge of how the coding language worked. 


Due to this issue, we ultimately decided to cut this part of the SmartPot from our prototype. In the end, we decided that the SmartPot will only have 1 input and 2 outputs. Those being the soil moisture sensor, the LCD and the pump respectively.


Problems faced by the fusion team (done by Hannah, Justin & Keith)

Problem

How we solved it

Problem #1: Inaccurate orientation of the pipe

The orientation of the pipe in the pot did not ensure that the water will be directly dispensed onto the plant (i.e. the pipe runs along the sides of the pot, but not in the middle where the plant is). 

Difficulty level: Hard

We decided to tape the tubes together in a way such that the areas where there are holes do not touch the walls, this will ensure that the water coming from the holes does not drip down along the walls but instead goes to the plant directly.


We also made the holes facing the plant. This can be seen in the pictures below.

Problem #2: Did not consider the placement of the soil moisture sensor

The soil moisture sensor was placed at the side of the pot. This means that it will only measure the moisture level of the soil at the sides of the pot. Hence, it will not accurately measure the moisture of the soil around the plant (which is placed in the middle of the pot). 

Difficulty level: Moderate

We made a hole along the side of the electronic box which gave the soil moisture sensor a shorter route to reach the middle of the pot, due to its short wire length.

Problem #3: Did not consider the possible plant size 

The plant we received was extremely small (i.e. only ~2cm across the diameter). This meant that our pot dimensions (15cm x 15cm x 15cm) were extremely oversized

Difficulty level: Hard

We decided to change the dimensions of our pot to 15cm x 7cm x 15cm. This led to us having to redo the CAD design on Fusion360. 

Problem #4: Incorrect placement of LCD screen

Placing the LCD screen on the cover of the electronic box turned out to be troublesome as the wires that connected the Arduino to the LCD screen were not long enough. 

So, it will be a problem when opening the electronic box. Additionally, the placement of the LCD screen may not be very convenient for the user to view the moisture level from. 

Difficulty level: Moderate

We decided to place the LCD screen on the top of the electronic box, facing upwards. We felt that this was the most logical spot to place the LCD screen as the pot will usually be on the floor and it will automatically be facing the user when checking the soil moisture level.

However, it also took us some time to come to a conclusion on where to place the LCD screen as it could have interfered with the latch (our working mechanism). 

Problem #5: Estimating and deciding on how we were going to cut the holes along the pipe. 

Finding out the number of holes to cut and their placements along the tube

Difficulty level: Moderate

We first had to estimate the section of the tube that will be in the SmartPot. Next, we decided to cut 6 small holes that are facing the plant. Through trial and error, we decided that 3 holes were enough to supply the plant with water. As such, we used duct tape to cover the rest of the holes.




PROJECT DESIGN FILES AS DOWNLOADABLE FILES  
Hyperlink for all the design files: Project Design Files


LEARNING REFLECTION
CPDD and ICPD have taught me many new skills such as CADD drawing🎨, 3d printing, cardboard joinery methods, soldering, coding, laser cutting etc. All these skills had prepared me to be more competent in designing, building and programming skills as I have never thought that chemical engineering students have to learn how to code, laser cut and 3d print. 😮

This is a bit of an irony that I am actually starting to enjoy coding😁. I mentioned that I hated coding in my Arduino programming blog because it was very time-consuming and I felt that the amount of effort I put in wasn't reflected well in the practical session.😖

However, in this project, I decided to be in the coding team because I think I could do better and further my potential because I have nothing to lose to learn more knowledge about coding. I have friends and teachers to guide me and clarify my doubts whenever I face an error in my code. It's very satisfacting to see my code worked out so I guess it is the joy I felt throughout this prototyping journey that changed my perspective on coding.

A quick shout-out to my team I really enjoyed working with this team a lot because all of the members were very participative, resourceful and proactive. E.g., on Fri (17 Feb) we realised that we took the wrong hero shot and forgot to cut a hole in the tube so we had an impromptu meeting on Sat (18 Feb) to help out and finish the prototype. We never work alone, we always work together as a team even though we might have some miscommunications issue. We will always clarify and send reminders to one another about the deadline of each task so that we won't delay the progress.

CPDD definitely gave me a quick insight into the capstone project as we are able to build a more functional prototype as compared to a cardboard prototype. It also taught us how to be resourceful as well to train us to be more component and independent.